import 'package:flutter/material.dart';

class ScrollHomePage extends StatefulWidget {
  @override
  _ScrollHomePageState createState() => _ScrollHomePageState();
}

class _ScrollHomePageState extends State<ScrollHomePage> {
  String img =
      "https://tse3-mm.cn.bing.net/th/id/OIP.IdSm_t1f3htXl_hCwtGXLgHaEo?pid=ImgDet&rs=1";
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
      //   title: Text("scroll配置"),
      // ),
      // 线性布局
      body: CustomScrollView(
        physics: BouncingScrollPhysics(),
        slivers: [
          SliverAppBar(
            leading: Icon(Icons.home),
            title: Text("讲解组合动画"),
            actions: [Icon(Icons.menu)],
            pinned: true,
            floating: true,
            backgroundColor: Colors.pink,
            expandedHeight: 180,
            flexibleSpace: FlexibleSpaceBar(
              background: Row(
                children: [
                  Expanded(child: Image.network(img, fit: BoxFit.cover))
                ],
              ),
            ),
          ),
          SliverList(
            delegate:
                SliverChildBuilderDelegate((BuildContext context, num index) {
              return Container(
                height: 44,
                margin: EdgeInsets.only(bottom: 10),
                child: Text('item $index'),
              );
            }, childCount: 30),
          ),
        ],
      ),
    );
  }
}
